#include <stdio.h>
#include <stdlib.h>

typedef struct treenode
{
	int data;
	struct treenode *left;
	struct treenode *right;
}tree_node;

tree_node *creattree(int mydata);
int view(tree_node *A);


int main(int argc, const char *argv[])
{
	tree_node *A=creattree(1);
	tree_node *B=creattree(2);
	A->left=B;
	tree_node *C=creattree(3);
	B->left=C;
	tree_node *D=creattree(4);
	C->left=D;
	tree_node *E=creattree(5);
	A->right=E;
	tree_node *F=creattree(6);
	E->left=F;
	tree_node *G=creattree(7);
	E->right=G;
	tree_node *H=creattree(8);
	G->left=H;
	tree_node *I=creattree(9);
	H->left=I;
	tree_node *g=creattree(0);
	H->right=g;

	view(A);
	return 0;
}

tree_node *creattree(int mydata)
{
	tree_node *H=(tree_node *)malloc(sizeof(tree_node));
	H->data=mydata;
	H->left=NULL;
	H->right=NULL;

	return H;
}

int view(tree_node *A)
{
//	if(A->left==NULL&&A->right==NULL)
	if(A==NULL)
	{
		return 0;
	}
	printf("%d ",A->data);
	view(A->left);
	view(A->right);

	return 0;
}


